{include file="Include/head" /}
<style>

</style>
<script>
if(window.top !== window.self){ window.top.location = window.location;}
function changeverify() {
    $("#vy").attr('src', $("#vy").attr('src') );
}
</script>

        <div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div style="height:200px">
            <h1 class="logo-name"></h1>
        </div>
        <h3>欢迎使用 </h3>
        <form class="m-t" role="form" action="javascript:;">
            <div class="form-group">
                <input type="text" id="admin_name" name="admin_name" class="form-control" placeholder="用户名" required="">
            </div>
            <div class="form-group">
                <input type="password" id="admin_password" name="admin_password" class="form-control" placeholder="密码" required="">
            </div>
            <div class="form-group">
                <input type="text" class="form-control"  placeholder="验证码" id="vertification" name="vertification" >
                <img id='vy' src="{:Url('/index.php?s=/captcha')}" onclick="this.src='{:Url('/index.php?s=/captcha')}'" width="120" height="37"  alt="" />
                <a href="#" onclick="changeverify()">看不清,换一张</a>
            </div>
            <button type="button" class="btn btn-primary block full-width m-b"  onclick="btnlogin();">登 录</button>
        </form>
    </div>
</div>



{include file="include/foot" /}
<script>
$(function(){
  changeverify();
})
function btnlogin(){
    // 后台验证
    var admin_name = $('#admin_name').val();
    var admin_password = $('#admin_password').val();
    var vertification = $("#vertification").val();
    $.post("{:url('Login/loginCheck')}", {
        "userName" : admin_name,
        "password" : admin_password,
        "vertification" : vertification
    }, function(data) {
        console.log(data);
        if (data['code'] > 0) {
            //$(".sub_login").attr("disabled", "disabled");
            window.location.href = "{:Url('Index/index')}";
        } else {
            //$("#txtPWD").val("");//清空密码
            //$("#txtValidate").val("");
            //$("#hint").show();
            alert(data['message']); //  用户名密码提示
            $("#verify_img").attr("src",'{:Url('/index.php?s=/captcha?tag=1')}&send='+Math.random());
        }
    });
}
</script>
